package com.forest.datachangetracker.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * 审计日志.
 *
 * @author forest
 */
@Data
@TableName("sys_audit_log")
public class SysAuditLog {

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("operation_type")
    private String operationType;

    @TableField("target_entity")
    private String targetEntity;

    @TableField("target_id")
    private String targetId;

    @TableField("operator_id")
    private String operatorId;

    @TableField("operator_name")
    private String operatorName;

    @TableField("operation_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime operationTime;

    @TableField("client_ip")
    private String clientIp;

    @TableField("method_name")
    private String methodName;

    @TableField("parameters")
    private String parameters;

    @TableField("old_values")
    private String oldValues;

    @TableField("new_values")
    private String newValues;

    @TableField("changed_fields")
    private String changedFields;

    @TableField("success")
    private Boolean success;

    @TableField("error_message")
    private String errorMessage;

    @TableField("tenant_id")
    private String tenantId;

    @TableField("business_key")
    private String businessKey;

    @TableField("description")
    private String description;

    @TableField("batch_id")
    private String batchId;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
}
